#pragma once

#include "MovingObject.h"
#include "Emitter.h"
#include <vector>

class ParticleSystem
{
public:
	//SINGLETON:
	// static accessor to get the singleton object
	static ParticleSystem* GetInstance();
	static void DeleteInstance();

	void Initialize();
	void Exit();

	int LoadEmitters();
	Emitter* LoadEmitterXML(string file, MovingObject* what = nullptr);

	map<string, Emitter*> GetEmitterMap() const { return emitterMap; }

private:
	// Particle System instance
	static ParticleSystem* pInstance;

	// ctor / dtor
	ParticleSystem() = default;
	~ParticleSystem() { Exit(); }

	// cctor / assop
	ParticleSystem(const ParticleSystem&) = delete;
	ParticleSystem& operator= (const ParticleSystem&) = delete;

	// private members
	int emitType;
	float lineRotation;
	SGD::Vector circleVector;
	SGD::Vector lineVector;
	SGD::Size emitterRectSize;
	float endRotation;
	SGD::Color endColor;
	SGD::Vector endVel;
	SGD::Vector endScale;

	float emitterLife;
	float spawnRate;
	float particleMaxAge;
	float startRotation;
	int maxNumParticles;
	SGD::Color startColor;
	SGD::Point position;
	SGD::Vector startVel;
	SGD::Vector startScale;
	SGD::HTexture particleImage;
	bool isLooping;

	// map of emitters
	map<string, Emitter*> emitterMap;
};

